package com.bw.workonedemo02

import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.bw.lib_base.mvvm.BaseActivity
import com.bw.workonedemo02.adapter.IVideoAdapter
import com.bw.workonedemo02.databinding.ActivityMainBinding
import com.bw.workonedemo02.video.IVideoViewModel
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : BaseActivity<ActivityMainBinding,IVideoViewModel>() {

    val videoAdapter by lazy { IVideoAdapter() }

    override fun initView() {
        binding.rvIvideos.adapter = videoAdapter
        binding.rvIvideos.layoutManager = LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false)

        vm.getIVideos(1,10)

    }

    override fun initData() {
        vm.getIVideoSuccess.observe(this){
            videoAdapter.addData(it)
            videoAdapter.notifyDataSetChanged()
        }
    }

}